<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-天下商旅</title>
<link href="${ctx}/resources/css/page_financial.css" rel="stylesheet"	type="text/css">
<link href="${ctx}/resources/css/pagination.css" rel="stylesheet" type="text/css">
</head>

<body>


	<jsp:include page="../commons/header.jsp">
		<jsp:param name="currentMenu" value="menu4" />
	</jsp:include>




	<div class="main_box">
		<div class="main cf">

			<jsp:include page="../commons/left.jsp"></jsp:include>
			<div class="right">
				<div class="right_box">
					<div class="title">
						<span><a href="#">申请提现</a></span>
					</div>
					<div class="content cf">
						<div class="applycash_box">
							<img class="top_img" src="${ctx}/resources/img/top5.png">
							<div class="applycash_bottom">
								<div class="applycash_bottom_title cf">
									<a href="#" id="js_tab1" class="current">提现</a><a href="#"
										id="js_tab2" class="">提现列表</a>
								</div>
								<div id="js_tab_box1">
									<form id="applycash" name="applycash" action="" novalidate>
										<div>
											<label>账户余额</label>
											<fmt:formatNumber value="${memberWallet.walletRemain}"
												pattern="##.##" minFractionDigits="2"></fmt:formatNumber>
											元
										</div>
										<div>
											<label><i>* </i>提现金额</label> <input type="text" class="input"
												name="money" id="money" /><span></span> <input
												name="userAccount" id="userAccount"
												value="${memberWallet.baseUsername.baseUsername }"
												type="hidden" />
										</div>
										<div>
											<label></label> <span
												style="text-align: life; padding-left: 0px;">提现手续费5%</span>
										</div>
										<div>
											<label>&nbsp;</label> <input type="submit"
												class="submit btn_orange" value="提交" />
										</div>

									</form>
								</div>
								<div id="js_tab_box2">
									<table id="table" class="table center">
										<thead>
											<tr>
												<th width="90">提现金额</th>
												<th width="60">手续费</th>
												<th width="90">实际到账</th>
												<th width="90">提现状态</th>
												<th width="90">提现时间</th>
												<th width="60">操作</th>
											</tr>
										</thead>
										<tbody>
										   	<c:forEach varStatus="status" var="memberExtractList" items="${pageData.result}">
												<tr>
													<td>${memberExtractList.extractAmount}</td>
													<td>${memberExtractList.extractHaddingfee}</td>
													<td>${memberExtractList.extractAmountFact}</td>
													<td>
														<c:choose>
															<c:when test="${memberExtractList.extractState == 0}">未处理</c:when>
															<c:when test="${memberExtractList.extractState == 1}">处理成功</c:when>
															<c:when test="${memberExtractList.extractState == 2}">处理失败</c:when>
														</c:choose>
													</td>
													<td><fmt:formatDate value="${memberExtractList.extractApplyTime}" pattern="yyyy-MM-dd" /></td>
													<td><a href="#">查看</a></td>
												</tr>	
										    </c:forEach>										
										</tbody>
									</table>
									<div class="page">${pagination}</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>

	<jsp:include page="../commons/footer.jsp"></jsp:include>

	<script src="${ctx}/resources/script/validate/jquery-1.4.min.js"
		type="text/javascript"></script>
	<script src="${ctx}/resources/script/common.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/script/validate/jquery.validate.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/script/validate/jquery.metadata.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/script/validate/additional-methods.js"
		charset="utf-8"></script>
	<script type="text/javascript"
		src="${ctx}/resources/script/validate/messages_cn.js" charset="utf-8"></script>
	<script type="text/javascript">
		$(function() {
			$.validator.setDefaults({
				submitHandler : function() {
					submitApplycash();
				}
			});

			$.validator.addMethod("sizeV", function(value, element) {
				var reg = /^(([1-9])|([1-9][0-9]{1,}))$/;
				return this.optional(element) || (reg.test(value));
			}, "转账金额必须为大于零的整数");

			function submitApplycash() {
				var url = "${ctx}/mW/withdrawals?timestap="
						+ (new Date()).valueOf();
				$
						.ajax({
							type : "post",
							async : false,
							url : url,
							dataType : "json",
							data : $("form").serialize(),
							success : function(getmsg) {
								alert(getmsg.context);
								window.location.href = "${ctx}/financial/withdrawalsList?timestap="
										+ (new Date()).getTime();
							}
						});
			}

			$("form").validate({
				rules : {
					money : {
						required : true,
						sizeV : "",
						remote : {
							url : "${ctx}/mW/vftBalance", //后台处理程序    
							type : "post",
							dataType : "json", //接受数据格式      
							data : { //要传递的数据   
								balance : function() {
									return $("#money").val();
								}
							}
						}
					}
				},
				errorPlacement : function(error, element) {
					error.appendTo(element.next("span"));
				},
				messages : {
					money : {
						requried : "提现金额不能为空",
						remote : "电子钱包余额不足"
					}
				}
			});
		});
	</script>
</body>
</html>
